package com.winit.schedule;

import com.winit.operation.BeetleOathUpdator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class UserSynchronizationTimingTask {

    private static Logger log = LoggerFactory.getLogger(UserSynchronizationTimingTask.class);

    @Autowired
    private BeetleOathUpdator beetleOathUpdator;


    @Scheduled(cron="0 00 12 * * ?")
    public void forenoonSynchronization(){
        log.info("forenoonSynchronization job start:" + new Date());
        beetleOathUpdator.execute();
        log.info("forenoonSynchronization job end:" + new Date());
    }

    @Scheduled(cron="0 10 18 * * ?")
    public void afternoonSynchronization(){
        log.info("afternoonSynchronization job start:" + new Date());
        beetleOathUpdator.execute();
        log.info("afternoonSynchronization job end:" + new Date());
    }
}
